<div class="largeCategory">
    Tools
</div>
<div>
    <div class="button" onclick="loadContent('project/addproject')">
        Add project
    </div>
    <div class="button" id="addendpoint" onclick="loadContent('project/addendpoint')">
        Add endpoint
    </div>
    <div class="button" id="addsuite" onclick="loadContent('project/addtestsuite')">
        Add testsuite
    </div>
    <div class="button" id="adddatasource" onclick="loadContent('ds/manageds')">
        Manage datasources
    </div>
    <div class="smallCategory">Devel tools</div>
    <div class="button" onclick="fullCleanup()">
        Full cleanup
    </div>
</div>
<div class="largeCategory">
    Projects
</div>
<div id="projects"></div>
<script>


    post("project", {
        "method" : "getAllProjects"
    }, getProjectsHandler);

    function fullCleanup() {
        post("devel", {
            "m" : "cleanup"
        }, null);
    }

    function getProjectsHandler(data) {
        for (var key in data) {
            $("#projects").append("<div class='clickable' onclick='openProject(\"" + key + "\",\"" + data[key] + "\")'>" + data[key] + "</div>");
        }
    }

    function openProject(projectKey, pn) {
        projectName = pn;
        loadId("content", "project/projectcontent");
        if (projectName != null && projectName != "") {
            $("#addendpoint").show();
            $("#addsuite").show();
        } else {
            $("#addendpoint").hide();
            $("#addsuite").hide();
        }
    }

    if (projectName != null && projectName != "") {
        $("#addendpoint").show();
        $("#addsuite").show();
    } else {
        $("#addendpoint").hide();
        $("#addsuite").hide();
    }
</script>
